<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  
</head>
<body>
  <div id="task">
    hello
  </div>
  <script>
    var task = document.querySelector('#task')
   
    let i = 0
    while (i < 100000) {
      console.log(i)
      i++
    }
    
    
    setTimeout(() => {
      alert('宏任务：' + task.innerHTML)
    }, 0)

    var p = new Promise((resolve, reject) => {
      resolve()
    })
    p.then(() => {
      var a = task.innerHTML
      alert('微任务：' + a)
    })


    // queueMicrotask(() => {
    //   var a = task.innerHTML
    //   alert('微任务：' + a)
    // })
    // queueMicrotask(() => {
    //   alert('微任务')
    // })

    
</script>
</body>
</html>